{template "content","header"}
<!-- 面包屑 begin -->
<div class="breadcrumb">
    <h3>{$CATEGORYS[$catid][catname]}</h3><div class="crumbs"><a href="{siteurl($siteid)}">首页</a><span> > </span>{catpos($catid)} 正文</div>
</div>
<!-- end 面包屑-->

<!-- main  begin -->
<div class="main clearfix">
    <div class="product w clearfix">
        <div id="preview">
            <img src="{thumb($thumb,392,0)}" alt="{$title}"/>
        </div>
        <div class="product-intro">
           <ul id="summary">
               <li><div id="name">{$title}</div></li>
               <li><div class="dt">作　　者：</div><div class="dd">{$author}</div></li>
               <li><div class="dt">外文书名：</div><div class="dd">{$ename}</div></li>
               <li><div class="dt">类　　别：</div><div class="dd">{$booktype}</div></li>
               <li><div class="dt">版　　次：</div><div class="dd">{$edition}</div></li>
               <li><div class="dt">出 版 商：</div><div class="dd">{$publishers}</div></li>
               <li><div class="dt">语　　种：</div><div class="dd">{$language}</div></li>
               <li><div class="dt">平　　装：</div><div class="dd">{$paperback}</div></li>
           </ul>
            <div id="price">
                <link href="{APP_PATH}statics/css/dialog.css" rel="stylesheet" type="text/css">
                <script type="text/javascript" src="{APP_PATH}statics/js/dialog.js"></script>
                <ul>
                    <li><i>定价：￥{$price}</i>{if !hasPayment($id)}<a href="javascript:void(0);" id="btn-order" class="btn-order" {if logined()==1}flag="1"{elseif logined()==-1}flag="-1"{/if}>预 订</a>{else}<a href="javascript:void(0);" class="btn-ordered"></a>{/if}</li>
                    <li>（仅限于使用一切非商业用途，商业用途请<a href="{$CATEGORYS[11][url]}" target="_blank" class="red">联系我们</a>）</li>
                </ul>
                <script type="text/javascript">
                    $(function(){
                        var odr = $("#btn-order");
                        odr.click(function(){
                                    if($(this).attr("flag")==1)
                                    {
                                        handlePayment();
                                    }
                                    else if($(this).attr("flag")==-1)
                                    {
                                        art.dialog({
                                            id: 'msgbox',
                                            drag: false,
                                            resize: false,
                                            icon:'warning',
                                            title:"警告",
                                            fixed:true,
                                            content: '亲，登录以后才能订购哟！ <p><a href="{APP_PATH}index.php?m=member&c=index&a=login&siteid={$siteid}&forward=http://{$_SERVER["HTTP_HOST"]}{$_SERVER["REQUEST_URI"]}">登录</a>&nbsp;|&nbsp;<a href="{APP_PATH}index.php?m=member&c=index&a=register&siteid={$siteid}&forward=http://{$_SERVER["HTTP_HOST"]}{$_SERVER["REQUEST_URI"]}">注册</a>&nbsp;</p>',
                                            cancelVal: '关闭',
                                            cancel: true //为true等价于function(){}
                                        });
                                    }
                        });
                    });

                    /**
                     * 处理支付函数
                     */
                    function handlePayment()
                    {
                        var odr = $("#btn-order");
                        art.dialog({
                            id: 'msgbox',
                            drag: false,
                            resize: false,
                            fixed:true,
                            content: '系统将扣除您 <font color="red">{$price}</font> 元',
                            ok: function () {
                                var myDialog = art.dialog({id:'msgbox'});
                                $.ajax({
                                    type: "POST",
                                    url: "/api.php?op=buy_book&id={$id}",
                                    dataType: "JSON",
                                    beforeSend:function()
                                    {
                                        myDialog.content("<img src='{SKIN_PATH}images/ajax-loader.gif' class='ajaxloader'/> 正在处理请求数据...");
                                        myDialog.button({name:"确定",visibility:"hidden"});
                                        myDialog.button({name:"关闭",visibility:"hidden"});
                                    },
                                    success: function(data){
                                        if(data.price==-1)
                                        {
                                            myDialog.content("您已订购过本书，无须重复订购，谢谢！");
                                            odr.removeClass("btn-order").addClass("btn-ordered").unbind("click");
                                            myDialog.button({name:"关闭",visibility:"visible"});
                                        }
                                        else if(data.price==-2)
                                        {
                                            myDialog.content("对不起！您的余额不足，请充值后再购买，谢谢！");
                                            myDialog.button({name:"充值",focus:true,callback:function(){window.open('{APP_PATH}index.php?m=pay&c=deposit&a=pay');}},{name:"取消"});
                                        }
                                        else
                                        {
                                            myDialog.content("订购成功，成功支付 <font color='#F00'>"+data.price+ "</font> 元，刷新页面即可下载");
                                            myDialog.button({name:"关闭",visibility:"visible"});
                                            odr.removeClass("btn-order").addClass("btn-ordered").unbind("click").html("");
                                        }
                                    }
                                });
                                return false;
                            },
                            cancelVal: '关闭',
                            cancel: true //为true等价于function(){}
                        });
                    }

                </script>
            </div>
        </div>
    </div>
    <div class="w clearfix">
        <div class="tab-box clearfix">
            <ul class="tab">
                <li class="green tab-item"><a href="javascript:void(0);">作者简介</a></li>
                <li class="blue tab-item"><a href="javascript:void(0);">勘误列表</a></li>
                <li class="yellow tab-item"><a href="javascript:void(0);">内容列表</a></li>
            </ul>
            <ul class="tab-content">
                <li class="author-info tab-cent">
                    {$authorinfo}
                </li>
                <li class="error-info tab-cent" style="display:none">
                    <link href="{APP_PATH}statics/11m/css/form.css" rel="stylesheet" type="text/css">
                    <link href="{APP_PATH}statics/css/dialog.css" rel="stylesheet" type="text/css">
                    <script type="text/javascript" src="{APP_PATH}statics/js/dialog.js"></script>
                    <form action="{APP_PATH}index.php?m=formguide&c=index&a=show&formid=16&siteid=1" method="post">
                    <ul class="error-box clearfix">
                        <li>
                            <div class="dt">书名：</div>
                            <div class="dd"><input type="text" class="input-text" name="info[title]" id="title"/></div>
                        </li>
                        <li>
                            <div class="dt">页码：</div>
                            <div class="dd"><input type="text" class="input-text" name="info[pageat]" id="pageat"/><span class="redtips">*</span>请输入整数</div>
                        </li>
                        <li>
                            <div class="dt">栏：</div>
                            <div class="dd">
                                <input value="左栏" type="radio" name="info[bar]" id="left-col" checked="checked"/>&nbsp;左栏
                                <input value="中栏" type="radio" name="info[bar]" id="middle-col"/>&nbsp;中栏
                                <input value="右栏" type="radio" name="info[bar]" id="right-col"/>&nbsp;右栏
                                <input value="通栏" type="radio" name="info[bar]" id="banner-col"/>&nbsp;通栏
                            </div>
                        </li>
                        <li>
                            <div class="dt">排数：</div>
                            <div class="dd">
                                <input type="text" class="input-text" name="info[rowat]" id="rowat"/><span class="redtips">*</span>请输入整数
                            </div>
                        </li>
                        <li>
                            <div class="dt">错误：</div>
                            <div class="dd">
                                <textarea class="input-textarea" name="info[error]" id="error"></textarea>
                            </div>
                        </li>
                        <li>
                            <div class="dt">修正：</div>
                            <div class="dd">
                                <textarea class="input-textarea" name="info[modify]" id="modify"></textarea>
                            </div>
                        </li>
                        <li>
                            <div class="buttons"><input type="submit" class="btn-submit" name="dosubmit" value="提 交"/>&nbsp;&nbsp;<input type="reset" value="取 消" class="btn-cancel"/></div>
                        </li>
                    </ul>
                    </form>
                </li>
                <li class="content-info tab-cent" style="display:none">
                    <ul class="chapter-list">
                    {loop $upfiles $r}
                        {$r}
                    {/loop}
                    </ul>
                    <script type="text/javascript">
                        /**
                         * 检查用户是否已登录
                         */
                        function checkLogin()
                        {
                            art.dialog({
                                id: 'msgbox2',
                                drag: false,
                                resize: false,
                                icon:'warning',
                                title:"警告",
                                fixed:true,
                                content: '亲，必须登录并订购以后才能下载哟！ <p><a href="{APP_PATH}index.php?m=member&c=index&a=login&siteid={$siteid}&forward=http://{$_SERVER["HTTP_HOST"]}{$_SERVER["REQUEST_URI"]}">登录</a>&nbsp;|&nbsp;<a href="{APP_PATH}index.php?m=member&c=index&a=register&siteid={$siteid}&forward=http://{$_SERVER["HTTP_HOST"]}{$_SERVER["REQUEST_URI"]}">注册</a>&nbsp;</p>',
                                cancelVal: '关闭',
                                cancel: true //为true等价于function(){}
                            });
                        }

                        /**
                         * 检查用户是否已订购
                         */
                        function checkPayment()
                        {
                            art.dialog({
                                id: 'msgbox2',
                                drag: false,
                                resize: false,
                                icon:'warning',
                                title:"警告",
                                fixed:true,
                                content: '亲，必须订购以后才能下载哟！ ',
                                cancelVal: '关闭',
                                cancel: true, //为true等价于function(){}
                                button:
                                [
                                    {
                                        name:"订购",
                                        focus:true,
                                        callback:function()
                                        {
                                            handlePayment(); //处理支付
                                        }
                                    }
                                ]
                            });
                        }
                    </script>
                </li>
            </ul>
            <ul class="comment-box">
                <li class="comments cents">
                    {if $allow_comment && module_exists('comment')}
                    <iframe src="{APP_PATH}index.php?m=comment&c=index&a=init&commentid={id_encode("content_$catid",$id,$siteid)}&iframe=1" width="100%" height="100%" id="comment_iframe" frameborder="0" scrolling="no"></iframe>

                    {/if}
                    <!--<div class="mt"></div>
                    <div class="mc">
                        <dl class="clearfix comment-form">
                            <dt><a href="javascript:void(0);"><img src="images/noavatar.gif" alt=""/></a></dt>
                            <dd><textarea name="" id="" cols="30" rows="10"></textarea></dd>
                        </dl>
                        <p class="sub-comment clearfix"><input type="button" value="发表评论"/></p>
                    </div>
                    <div class="mlist clearfix">
                        <dl>
                            <dt><img src="images/avatar-01.gif" alt=""/></dt>
                            <dd>张三 <span class="say">刚刚说：</span> <a href="javascript:void(0);" class="reply">回复</a></dd>
                            <dd>这本书讲解的东西还很全面嘛</dd>
                        </dl>
                        <dl class="none">
                            <dt><img src="images/avatar-02.gif" alt=""/></dt>
                            <dd>李四 <span class="say">刚刚说：</span> <a href="javascript:void(0);" class="reply">回复</a></dd>
                            <dd>这本书真不错</dd>
                        </dl>
                    </div>-->
                </li>
                <li class="message-list cents" style="display:none">
                    <div class="mt">
                        <h3>留言内容</h3>
                        <ul>
                            <li><a href="#">排　序</a></li>
                            <li><a href="#">按页码</a></li>
                            <li><a href="#">按时间</a></li>
                        </ul>
                    </div>
                    <div class="mc">
                        {pc:get sql="SELECT * FROM `v9_form_bookerror` WHERE dataid = $id ORDER BY datetime DESC" cache="3600" page="$page" return="data"}
                        <ul>
                            {loop $data $key $val}
                            <li>
                                <div class="dt"><span class="ol">1、</span>|第{$val[pageat]}页|{$val[bar]}|第{$val[rowat]}行|</div>
                                <div class="dd">
                                    <p>错误之处：{$val[error]}</p>
                                    <p>修改：{$val[modify]}</p>
                                    <p>提交人：{$val[username]}</p>
                                    <p>提交时间：{date('Y-m-d H:i:s',$val[datetime])}</p>
                                </div>
                            </li>
                            {/loop}
                        </ul>
                        {if $pages}<DIV class=page>{$pages}</DIV>{/if}
                        {/pc}
                    </div>
                </li>
            </ul>
            <script type="text/javascript">
                $(function(){
                    var items = $(".tab-item");
                    var contents = $(".tab-cent");
                    var cents = $(".cents");
                    $.each(items,function(index,item){
                        $(this).click(function(){
                            //切换留言内容和读者评论
                            cents.hide();
                            if(index==0||index==2){
                                cents.eq(0).fadeIn();
                            }
                            else
                            {
                                cents.eq(1).fadeIn();
                            }
                            contents.hide();
                            contents.eq(index).fadeIn();
                        });
                    });

                });
            </script>
        </div>
    </div>

</div>
<!-- end main -->
{template "content","footer"}

<!--左侧浮动导航 begin -->
{template "content","inc_sidebar"}
<!-- end 左侧浮动导航-->